package com.batchaps.menu;

import java.io.IOException;

import javax.microedition.amms.GlobalManager;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import com.batchaps.classes.KindOfPlay;
import com.batchaps.classes.My2DSprite;
import com.batchaps.classes.My2DSpriteStruct;
import com.batchaps.classes.ObliqueLeftMove;
import com.batchaps.classes.ObliqueRightMove;
import com.batchaps.classes.StructSprite;
import com.batchaps.global.GameEngine;
import com.batchaps.global.Utils;

public class GameMenu extends Menu{
	
	//cat
	public My2DSpriteStruct cat;
	public My2DSpriteStruct dog;
	
	public KindOfPlay kindOfPlay;
	
	public GameMenu()
	{
		StructSprite ss = new StructSprite(0, 1, 2, 6, 65, 91, 7, 9, 10, 32, 55, 64, 33, 54, 92, 93 , 0 ,0);
		//create cats
		cat = new My2DSpriteStruct("/cats/Cats", 93, GameEngine.xCat , GameEngine.yCat, ss, "/menu/iconcat.png", 218, 2 ,"/bull/bcat.png",new ObliqueLeftMove());
		//create dog 
		ss = new StructSprite(0, 1, 0, 1, 2, 30,31 , 34, 35, 54, 55, 96, 97, 112, 113, 114, 0, 0);
		dog = new My2DSpriteStruct("/dogs/Dogs", 114, GameEngine.xDog , GameEngine.yDog, ss, "/menu/icondog.png", 218, 202 ,"/bull/bdog.png" , new ObliqueRightMove());

	}
	
	public void UpdateKindOfPlay(KindOfPlay kop)
	{
		this.kindOfPlay = kop;
	}
	
	//pointer release
	public int IsClick(int x, int y) {
		// TODO Auto-generated method stub
		if(kindOfPlay != null){
			kindOfPlay.PointerRelease(x, y);
		}
		return 0;
	}
	
	//pointer press
	public int pointerPress(int x ,int y)
	{
		if(kindOfPlay != null){
			kindOfPlay.PointerPress(x, y);
		}
		return 0;
	}

	public void Update() {
		// TODO Auto-generated method stub
		cat.Update();
		dog.Update();
	}

	public void Draw(Graphics g) {
		// TODO Auto-generated method stub
		cat.Draw(g);
		dog.Draw(g);
	}

}
